package com.dragon.logical.service.avttendance;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dragon.common.model.ResponseData;
import com.dragon.repository.entity.Attendance;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/**
 * <p>
 * 考勤表 服务类
 * </p>
 *
 * @author sy
 * @since 2023-07-10
 */
public interface IAttendanceService extends IService<Attendance> {

    /**
     * 获取打卡列表
     * @param adminId 用户id
     * @param time 时间
     * @param attendanceType 打卡的状态
     * @return
     */
    Map<String, List<Attendance>> clockList(Integer adminId, String time, Integer attendanceType);

    /**
     * 打卡
     * @param attendance
     */
    @Transactional(rollbackFor = RuntimeException.class)
    void adminInClock(Attendance attendance);

    /**
     * 统计用户打卡实际情况
     * @param time
     * @return
     */
    List<Map<String,Object>> getAttendMap(List<Integer> adminIds, String time);

    /**
     * 获取用户某天的详细信息
     * @param adminId
     * @return
     */
    Attendance showDetails(Integer adminId,String time);

    /**
     * 判断经纬度范围
     * @param adminId 用户id
     * @param actualLongitude 经度
     * @param actualLatitude 维度
     * @return
     */
    ResponseData determine(Integer adminId,  Double actualLongitude, Double actualLatitude);

    Page<Attendance> attList(Integer page, Integer limit, Integer adminId, String time);

    /**
     * 获取某个人某个月的打卡数据
     * @param adminId
     * @param time
     * @return
     */
    Map<String, Object> getList(Integer adminId, String time);

    /**
     * 考勤统计详情
     * @param adminId
     * @param time
     * @return
     */
    Attendance selectArrangeChildDetail(Integer adminId, String time);

    /**
     * 导出考勤统计
     * @param time
     * @param response
     */
    void exportTotal(String time, HttpServletResponse response) throws IOException;

    /**
     * 考勤详情导出
     * @param adminId
     * @param time
     * @param response
     */
    void exportList(Integer adminId, String time, HttpServletResponse response) throws UnsupportedEncodingException;
}
